package Thread.demo02;

public class One {
    /**
     * 线程八锁
     * 1、两个线程调用同一个对象的两个同步方法
     * @param args
     */
    public static void main(String[] args) {
        Number1 number = new Number1();

        new Thread(new Runnable() {
            @Override
            public void run() {
                number.getOne();
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                number.getTwo();
            }
        }).start();
    }
}
class Number1 {
    public synchronized void getOne() {
        System.out.println("one");
    }

    public synchronized void getTwo() {
        System.out.println("two");
    }
}